package wili.demo.misc;

import java.util.Stack;

/**
 * 
 * @author weila 2021年7月14日
 */
public class AndOrPatNode_demo extends AndOrKvNode {
	public AndOrPatNode_demo(String name, boolean isOr) {
		super(name, isOr);
	}

	public AndOrPatNode_demo(String name, Object value) {
		super(name, value);
	}

	public static void test() {
		AndOrPatNode_demo root = new AndOrPatNode_demo("", false);
		root.addSon(new AndOrPatNode_demo("a", true));
		root.addSon(new AndOrPatNode_demo("b", false));
		root.addSon(new AndOrPatNode_demo("c", true));
		root.son("b").sets("aa", "bb", "dd");
		root.son("a").set("a1", 100);
		root.son("a").set("a2", 200);
		root.son("c").addSon(new AndOrPatNode_demo("c1", false));
		root.son("c").addSon(new AndOrPatNode_demo("c2", true));
		root.print(1);
		root.threadPost();
		root.printThread();
		{
			for (int i = 0; i < 5; i++) {
				Stack<AndOrKvNode> path;
				int ind = 0;
				System.out.println("---------findNextPath():");
				while ((path = root.findNextPath()) != null) {
					++ind;
					System.out.println(ind + ": " + path);
				}
				root.reset();
			}
		}
	}

	public static void main(String[] args) {
		test();
	}
}
